/************************************************************
 * Project Name         [Thinking_In_Java]
 * File Name            [Award.java]
 * Creation Date        [22-Jul-2014]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ************************************************************/
package pkg_03_game.tankwar_local.version_6;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

/**
 * 回血奖励
 * 
 * @author 不落的太阳(Sean Yang)
 * @version 1.0
 * @since JDK 6
 * 
 */
public class Award {

	/** 绘制坐标 */
	private final int x;
	private final int y;

	/**
	 * 回血物品的宽度和高度
	 */
	private final int width = 10;
	private final int height = 10;

	private boolean live = true;

	public Award(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public void paint(Graphics g) {
		if (!live) {
			return;
		}
		Color color = g.getColor();
		g.setColor(Color.MAGENTA);
		g.fillRect(x, y, width, height);
		g.setColor(color);

	}

	public Rectangle getRect() {
		return new Rectangle(x, y, width, height);
	}

	public boolean isLive() {
		return true;
	}

	public void setLife(boolean b) {
		live = b;
	}
}
